package com.pz.art.controller;

import com.pz.art.domain.AssoEvents;
import com.pz.art.domain.AssoMemberInitiation;
import com.pz.art.service.ApplyAssociationService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/system")
public class ApplyAssociationController extends BaseController {

    @Autowired
    private ApplyAssociationService applyAssociationService;

    @Log(title = "会员申请列表", businessType = BusinessType.OTHER)
    @GetMapping("/apply")
    public TableDataInfo apply(AssoMemberInitiation assoMemberInitiation) {
        startPage();
        List<AssoMemberInitiation> list = applyAssociationService.getSelectMemberInitiation(assoMemberInitiation);
        return getDataTable(list);
    }

    @Log(title = "团队申请列表", businessType = BusinessType.OTHER)
    @GetMapping("/teamapply")
    public TableDataInfo teamapply(AssoMemberInitiation assoMemberInitiation) {
        startPage();
        List<AssoMemberInitiation> list = applyAssociationService.getSelectUnitInitiation(assoMemberInitiation);
        return getDataTable(list);
    }

    @Log(title = "会员审批", businessType = BusinessType.OTHER)
    @PostMapping("/memberapprove")
    public AjaxResult approve(@RequestBody AssoMemberInitiation assoMemberInitiation) {
        System.out.println(assoMemberInitiation);
        applyAssociationService.updataApprove(assoMemberInitiation);
        return success("审批成功");
    }
}
